package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 服务抽查表
 */
@JsonApiResource(type = "servicecheck")
@Table(name = "tnb_service_check")
@Entity
public class ServiceCheck extends BaseEntity {

	private Employee staff;// 检查人

	private Dicttype item;// 检查项

	private Integer createDateTime;

	private String remark;// 备注

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "staff_id", foreignKey = @ForeignKey(name = "null"))
	public Employee getStaff() {
		return staff;
	}

	public void setStaff(Employee staff) {
		this.staff = staff;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "item_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getItem() {
		return item;
	}

	public void setItem(Dicttype item) {
		this.item = item;
	}

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	public ServiceCheck() {
	}

	@Column(name = "remark", length = 2000)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
}
